-
-
Notifications
You must be signed in to change notification settings - Fork 648
Convert partitions into skew partitions automatically #40580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a partial fix that will cause confusion because
sage: SP = SkewPartitions()
sage: SP([3,2,1])
will not work. Rather than changing the constructor, better to change the __contains__
and _element_constructor_
of ``SkewPartitions`. Although this will mean doing a bit more work on the subclasses. However, I think it is a better way to do things and be a complete fix.
Documentation preview for this PR (built with commit 694e219; changes) is ready! 🎉 |
if skp in _Partitions: | ||
skp = SkewPartition(skp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if skp in _Partitions: | |
skp = SkewPartition(skp) | |
if skp in _Partitions: | |
skp = [_Partitions(skp), _Partitions([])] |
Less indirection (so faster) and will result in the correct parent. Please add an analogous test with a different parent (such as SkewPartitions(4)
) and make sure it has the correct output.
if not x in SkewPartitions(): | ||
return False | ||
x = SkewPartition(x) | ||
return sum(x[0])-sum(x[1]) == self.n \ | ||
and self.overlap <= SkewPartition(x).overlap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not x in SkewPartitions(): | |
return False | |
x = SkewPartition(x) | |
return sum(x[0])-sum(x[1]) == self.n \ | |
and self.overlap <= SkewPartition(x).overlap() | |
SP = SkewPartitions() | |
if not x in SP: | |
return False | |
x = SP(x) | |
return (sum(x[0]) - sum(x[1]) == self.n | |
and self.overlap <= x.overlap()) |
if x in SkewPartitions(): | ||
x = SkewPartition(x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if x in SkewPartitions(): | |
x = SkewPartition(x) | |
SP = SkewPartitions() | |
if x in SP: | |
x = SP(x) |
This here should work:
The present patch makes it so.